02. Old and New Browsers

Code doesn't work in old browsers

The code we've been looking at in this course is not supported by older browsers. Older browsers that were developed prior to the release of ES6 were developed to support the version of JavaScript at the time (which was ES5.1). If you try running any ES6 code in an older browser, it won't work.

_Attempting to run an arrow function in Safari 9, which does not support arrow functions. The result is a syntax error._

Attempting to run an arrow function in Safari 9, which does not support arrow functions. The result is a syntax error.

It makes sense that code doesn't work in older browsers that were developed prior to the release of ES6, but there are some browsers that have been released after ES6 that don't support the new JavaScript syntax and functionality yet.

Try using an arrow function in your code and opening it up in IE 11, and it won't work. There'll be an error on the console saying that it doesn't recognize the syntax.

_Attempting to run an arrow function in MSIE 11, which does not support arrow functions. The result is a syntax error._

Attempting to run an arrow function in MSIE 11, which does not support arrow functions. The result is a syntax error.

Most of us don't think much about the browser and all it can do…until it doesn't work! But really, browser makers have a tough time. Think about HTML, CSS, and JavaScript - these languages are fluid and are always improving. Browser makers have to keep up with all of these changes.

But how do they know about these changes?

They learn (or actually build) the language specifications!

Just like the World Wide Web Consortium (W3C) is the standards body for things like HTML, CSS, and SVG, Ecma International is an industry association that develops and oversees standards like JavaScript and JSON. You can find the specifications for ES6 here.

Further info

Ecma International is an important industry community and definitely worth checking out in more detail:

NOTE: The code we've been looking at in this course is not supported by older browsers. Older browsers that were developed prior to the release of ES6 were developed to support the version of JavaScript at the time (which was ES5.1). If you try running any ES6 code in an older browser, it won't work.